home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / packet / aprs75c / gpstohst.bas < prev    next >
BASIC Source File  |  1995-11-30  |  3KB  |  71 lines

  1. PRINT "This program takes a RAW PROCOMM download file from a GPS receiver"
  2. PRINT "in NMEA-0183 format and formats it to look like an APRS packet beacon"
  3. PRINT "It looks for the GGA and VTG sentences."
  4. PRINT
  5. PRINT "For LORAN or other sentences GLL or RMC, you will have to rewrite"
  6. PRINT "Several lines in the program..."
  7. PRINT
  8. INPUT "Enter file name of raw GPS data"; FI$
  9. INPUT "Select NMEA sentence to use RMC or GGA"; NMEA$
  10. INPUT "Enter name of OUTPUT file for APRS compatible TRACK HISTORY"; FO$
  11. INPUT "Enter callsign to be used with the raw data"; CALL$
  12. INPUT "Enter two digit DAY of data"; Day
  13. INPUT "Enter symbol for character (Car >, Air ', Boat ~)"; Sym$
  14. IF LEN(Sym$) <> 1 THEN Sym$ = ">"
  15. LET CALL$ = LEFT$(CALL$ + "         ", 10)
  16. OPEN FI$ FOR INPUT AS #1
  17. OPEN FO$ FOR OUTPUT AS #2
  18. IF UCASE$(NMEA$) = "GGA" THEN
  19.   DTG$ = MID$(DATE$, 4, 2) + LEFT$(TIME$, 2) + MID$(TIME$, 4, 2)
  20.   DO WHILE NOT EOF(1)
  21.      LINE INPUT #1, A$
  22.      IF LEFT$(A$, 6) = "$GPGGA" AND MID$(A$, 36, 1) = "1" THEN
  23.         LAT$ = MID$(A$, 15, 7)
  24.         LON$ = MID$(A$, 25, 8)
  25.         EST = VAL(MID$(A$, 8, 4)) - 500
  26.         IF EST < 0 THEN Tim = EST + 2400: Standby = 1 ELSE Tim = EST
  27.         IF EST > 0 AND Standby = 1 THEN Standby = 0: Day = Day + 1
  28.         UTC$ = RIGHT$("0" + MID$(STR$(Day), 2), 2) + RIGHT$("000" + MID$(STR$(Tim), 2), 4)
  29.         Pos$ = "/" + LAT$ + "N/" + LON$ + "W"
  30.      END IF
  31.      IF LEFT$(A$, 6) = "$GPVTG" THEN
  32.         CSE$ = Sym$ + MID$(A$, 8, 3)
  33.         SPD$ = "/" + MID$(A$, 26, 3)
  34.      END IF
  35.      Pkt$ = CALL$ + UTC$ + " @" + UTC$ + Pos$ + CSE$ + SPD$ + "/comments"
  36.      PRINT #2, Pkt$
  37.   LOOP
  38.   CLOSE
  39.  
  40. ELSE 'Or do the RMC here by N4WZR
  41.   DO WHILE NOT EOF(1)
  42.      LINE INPUT #1, A$
  43.      REM $GPRMC has 12 comma-separated fields.  This portion evaluates the input
  44.      REM string character by character and generates F$(1) thru F$(12).
  45.      REM F is field number and C is character number in A$ we're looking at.
  46.      DIM F$(12)
  47.      FOR A = 1 TO 12: F$(A) = "": NEXT A: F = 1: C = 1
  48.         DO UNTIL F = 12
  49.            IF MID$(A$, C, 1) = "," THEN F = F + 1 ELSE F$(F) = F$(F) + MID$(A$, C, 1)
  50.            C = C + 1
  51.         LOOP
  52.      REM
  53.      REM Now that we have 12 fields, we'll scrutinize them individually and
  54.      REM build our final variables.
  55.      REM
  56.      CALL$ = LEFT$(CALL$ + "         ", 10)
  57.      UTC$ = MID$(F$(10), 1, 2) + MID$(F$(2), 1, 4)
  58.      LAT$ = MID$(F$(4), 1, 7) + F$(5)
  59.      LON$ = MID$(F$(6), 1, 8) + F$(7)
  60.      CSE$ = F$(9)
  61.      SPD$ = F$(8)
  62.      Pos$ = " @" + UTC$ + "z" + LAT$ + "/" + LON$ + Sym$
  63.      Pkt$ = CALL$ + UTC$ + Pos$ + CSE$ + "/" + SPD$ + "/raw*/RMC Fix"
  64.      PRINT #2, Pkt$
  65.   LOOP
  66.   CLOSE
  67.  
  68. END IF
  69. END
  70.  
  71.